/*
 * @Author: jiu yin
 * @Date: 2023-04-27 14:23:19
 * @LastEditTime: 2023-06-05 09:55:11
 * @LastEditors: jiu yin zhen jing
 * @FilePath: \AI admin\vite.config.ts
 * jiu
 */
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";

function resolve(src: string): string {
   return path.join(__dirname, src);
}



export default defineConfig({
   plugins: [react()],
   resolve: {
      alias: {
         "@": resolve("./src"),
      },
      //extensions数组的意思是在import组件的时候自动补全.vue等文件后缀
      extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
   },
   server: {
      open: true,
      port: 9000,
      host: "192.168.0.153",
      proxy: {
         "/api": {
            target: "http://192.168.0.32:8000",
            changeOrigin: true,
         },
      },
   },

   build: {
      minify: "terser",
      terserOptions: {
         compress: {
            //生产环境时移除console
            drop_console: true,
            drop_debugger: true,
         },
      },
   },
});
